<div class="wrapper">
    <div>
        <div class="box box-top">
            <!-- /.box-header -->
            <!-- form start -->
            <form id="${objectName}Form" role="form" action="${r"${base}"}/admin/${objectName}/save" method="post">
                <input type="hidden" name="id" value="${r'${('}${objectName}.id${r')!}'}">
                <div class="box-body">
                    <#list pros as x>
                        <#if x.fieldName=='valid'>
                            <div class="form-group">
                                <label for="${x.fieldName}">${x.propertyName}</label>
                                <select  name="${x.fieldName}" id="${x.fieldName}" class="form-control">
                                    <option value="true" ${r'<#if '}((${objectName}.${x.fieldName})!true)==true> selected="selected" ${r'</#if>'}>----有效----</option>
                                    <option value="false" ${r'<#if '}((${objectName}.${x.fieldName})!true)==false> selected="selected" ${r'</#if>'}>----无效----</option>
                                </select>
                            </div>
                        <#else>
                            <div class="form-group">
                                <label for="${x.fieldName}">${x.propertyName}</label>
                                <input type="text" value="${r'${('}${objectName}.${x.fieldName}${r')!}'}" class="form-control" name="${x.fieldName}" id="${x.fieldName}">
                            </div>
                        </#if>

                    </#list>
                    <div class="box-footer">
                        <button type="button" onclick="$('#${objectName}Form').submit();" class="btn btn-primary">保存
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $("#${objectName}Form").validate({
            submitHandler:function(form){
                submit${className}();
            }
        });
    });
    function submit${className}(){
        HF.ajaxFormSubmit('${objectName}Form',function(result){
            alert("保存成功");
            document.location.reload();
        },function(e){ alert("保存失败");});
    }
</script>
